# -*- coding: utf-8 -*-
import scrapy

from qsbk.items import TencentItem


class TencentSpider(scrapy.Spider):
    name = 'tencent'
    allowed_domains = ['tencent.com']

    url = "https://careers.tencent.com/search.html?index="
    offset = 0
    start_urls = [url+str(offset)]

    def parse(self, response):

        for each in response.xpath('//div[@class="recruit-list"]'):
            # item = TencentItem()
            
            item["name"] = each.xpath("//h4/text()").extract()
            print(item["name"])

            # yield item

        # if self.offset < 2:
        #     self.offset += 1
        # else:
        #     raise "结束工作"
        # yield scrapy.Request(self.url+str(self.offset), callback=self.parse)
